package com.demo.service;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.demo.dao.AccountDao;
import com.demo.dao.GenericDao;
import com.demo.model.Account;
import com.demo.two.TwoDao;

/**
 * @ClassName: AccountService
 * @Description:
 */

@Service
public class AccountService {

	@Resource
	private AccountDao accountDao;
	
	@Resource
	private TwoDao twoDao;
	
	public List<Account> getAccount(){
		List<Account> list = new ArrayList<Account>();
		System.out.println("=======sssssssssss========");
		Account a= accountDao.find(1);
		list.add(a);
		System.out.println("=========eeee========="+a);
		Account b = twoDao.find(1);
		list.add(b);
		System.out.println("====s=s==s=s=s==s==s=s====="+b);
		return list;
	}
	
	public void saveTwo(){
		System.out.println("==iii======aaaa=======");
		Account a = new Account();
		a.setAccount("aa");
		a.setPassword("ap");
		a.setCreateTime(new Date());
		a.setDeleted(false);
		a.setName("ann");
		accountDao.persist(a);
		System.out.println("==iii======eeeeeeee=======");
		Account b = new Account();
		b.setAccount("bb");
		b.setPassword("bp");
		b.setCreateTime(new Date());
		b.setDeleted(false);
		b.setName("bnn");
		twoDao.persist(b);
		System.out.println("==iii======tttttttttt=======");
	}
	
}
